package top.aicey.ai.sparring.processor;


import com.google.common.base.Joiner;
import top.aicey.ai.sparring.common.holder.SparringConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class DefaultLogIndexContextProcessorSelector implements LogIndexContextProcessorSelector, NameGenerateProcessor {

    @Autowired
    private Map<String, LogIndexContextProcessor> logIndexContextProcessorMap;

    @Autowired
    private SparringConfigProperties properties;

    @Override
    public LogIndexContextProcessor get() {
        return logIndexContextProcessorMap.get(generate());
    }

    @Override
    public String generate() {
        return Joiner.on("").join(properties.getMode(),LogIndexContextProcessor.class.getSimpleName());
    }
}
